#include "IPEndpoint.h"

SK

IPEndpoint::IPEndpoint ()
{

}

IPEndpoint::~IPEndpoint()
{

}

IPEndpoint::IPEndpoint (const IPEndpoint& other)
{
    //TODO
    
}

String IPEndpoint::toString (void)
{
    //TODO
    return ("");
}

bool IPEndpoint::resolve (const String& host, u16 port)
{
    hostent *rhost; //where does this get deleted?
    rhost = gethostbyaddr (host.c_str(), host.length(), AF_INET);
    memcpy (&ep.sin_addr.s_addr, rhost->h_addr, sizeof (rhost->h_length));
    ep.sin_family = AF_INET;
    ep.sin_port = htons (port);
    return true;
}

bool IPEndpoint::setBroadcast (u16 port)
{
    ep.sin_addr.s_addr = INADDR_BROADCAST;
    ep.sin_port = htons (port);
    ep.sin_family = AF_INET;
    return true;
}

sockaddr_in IPEndpoint::getEP(void)
{
    return ep;
}

EK